<!DOCTYPE html>
<html>
<head>
    

    

    



    <meta charset="utf-8">
    
    
    
    
    <title>添加账户SSH （免密码上传） | Anson&#39;s Blog | 种一棵树最好的时间在十年前，其次是现在。</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="Hexo">
    <meta name="description" content="SSH以前没有添加SSH时，每次上传博文都要输入一次账户和密码，异常麻烦，这次我吧博客部署了三个git托管的主流平台（Guthub/Coding/码云）那可是要输三次账户名和密码的，为了方便节省时间就在网上找了找关于ssh教程，奈何都不是很全面，遇见不少坑，今天自己爬完坑自己记录一下，下次万一用到还可以翻出来看看，  参考 配置SHH配置shh key是让本地git项目与远程的github建立联系">
<meta name="keywords" content="Hexo">
<meta property="og:type" content="article">
<meta property="og:title" content="添加账户SSH （免密码上传）">
<meta property="og:url" content="http://yoursite.com/2018/01/06/设置账户SSH/index.html">
<meta property="og:site_name" content="Anson&#39;s Blog">
<meta property="og:description" content="SSH以前没有添加SSH时，每次上传博文都要输入一次账户和密码，异常麻烦，这次我吧博客部署了三个git托管的主流平台（Guthub/Coding/码云）那可是要输三次账户名和密码的，为了方便节省时间就在网上找了找关于ssh教程，奈何都不是很全面，遇见不少坑，今天自己爬完坑自己记录一下，下次万一用到还可以翻出来看看，  参考 配置SHH配置shh key是让本地git项目与远程的github建立联系">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://www.2cto.com/uploadfile/Collfiles/20160329/20160329134812521.jpg">
<meta property="og:image" content="https://www.2cto.com/uploadfile/Collfiles/20160329/20160329134812522.png">
<meta property="og:image" content="https://www.2cto.com/uploadfile/Collfiles/20160329/20160329134812523.png">
<meta property="og:image" content="https://www.2cto.com/uploadfile/Collfiles/20160329/20160329134812524.png">
<meta property="og:image" content="https://www.2cto.com/uploadfile/Collfiles/20160329/20160329134812525.png">
<meta property="og:image" content="https://www.2cto.com/uploadfile/Collfiles/20160329/20160329134812526.png">
<meta property="og:updated_time" content="2018-10-19T09:04:58.119Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="添加账户SSH （免密码上传）">
<meta name="twitter:description" content="SSH以前没有添加SSH时，每次上传博文都要输入一次账户和密码，异常麻烦，这次我吧博客部署了三个git托管的主流平台（Guthub/Coding/码云）那可是要输三次账户名和密码的，为了方便节省时间就在网上找了找关于ssh教程，奈何都不是很全面，遇见不少坑，今天自己爬完坑自己记录一下，下次万一用到还可以翻出来看看，  参考 配置SHH配置shh key是让本地git项目与远程的github建立联系">
<meta name="twitter:image" content="https://www.2cto.com/uploadfile/Collfiles/20160329/20160329134812521.jpg">
    
        <link rel="alternate" type="application/atom+xml" title="Anson&#39;s Blog" href="/atom.xml">
    
    <link rel="shortcut icon" href="/img/favicon.ico">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@latest/css/style.css">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu"  >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/img/brand.jpg)">
      <div class="brand">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="https://yscoder.github.io/img/face.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">张宁乐</h5>
          <a href="mailto:zhangningle2017@gmail.com" title="zhangningle2017@gmail.com" class="mail">zhangningle2017@gmail.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                归档
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                标签
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/about"  >
                <i class="icon icon-lg icon-user"></i>
                关于
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/ansonznl" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">添加账户SSH （免密码上传）</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">添加账户SSH （免密码上传）</h1>
        <h5 class="subtitle">
            
                <time datetime="2018-01-06T02:09:45.000Z" itemprop="datePublished" class="page-time">
  2018-01-06
</time>


            
        </h5>
    </div>

    


</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap post-toc-shrink" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#SSH"><span class="post-toc-number">1.</span> <span class="post-toc-text">SSH</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#添加-SSH-Key-到-GitHub和Coding"><span class="post-toc-number">1.1.</span> <span class="post-toc-text">添加 SSH Key 到 GitHub和Coding</span></a></li></ol></li></ol>
        </nav>
    </aside>


<article id="post-设置账户SSH"
  class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">添加账户SSH （免密码上传）</h1>
        <div class="post-meta">
            <time class="post-time" title="2018-01-06 10:09:45" datetime="2018-01-06T02:09:45.000Z"  itemprop="datePublished">
2018-01-06
<!--2018-10-19 17:04:58-->
</time>

            


            
<span id="busuanzi_container_page_pv" title="文章总阅读量" style='display:none'>
    <i class="icon icon-eye icon-pr"></i><span id="busuanzi_value_page_pv"></span>
</span>


        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <h2 id="SSH"><a href="#SSH" class="headerlink" title="SSH"></a>SSH</h2><p>以前没有添加SSH时，每次上传博文都要输入一次账户和密码，异常麻烦，这次我吧博客部署了三个git托管的主流平台（Guthub/Coding/码云）那可是要输三次账户名和密码的，为了方便节省时间就在网上找了找关于ssh教程，<br>奈何都不是很全面，遇见不少坑，今天自己爬完坑自己记录一下，下次万一用到还可以翻出来看看，</p>
<ul>
<li><a href="https://www.2cto.com/kf/201603/496122.html" target="_blank" rel="noopener">参考</a></li>
<li>配置SHH<br>配置shh key是让本地git项目与远程的github建立联系</li>
</ul>
<ul>
<li>检查是否已经有SSH Key，打开Git Bash，输入<br><code>&lt;code class=&quot;hljs bash&quot;&gt;cd ~/.ssh&lt;/code&gt;</code><br>如果没有.ssh这个目录，则生成一个新的SSH，输入<br><code>&lt;code class=&quot;hljs lasso&quot;&gt;ssh-keygen -t rsa -C &quot;your e-mail&quot;&lt;/code&gt;</code><br>注意1: 此处的邮箱地址，你可以输入自己的邮箱地址；注意2: 此处的「-C」的是大写的「C」</li>
<li>接下来几步都直接按回车键,然后系统会要你输入密码<br><code>&lt;code class=&quot;hljs ruby&quot;&gt;Enter passphrase (empty for no passphrase):&lt;输入加密串&gt;</code><br><code>Enter same passphrase again:&lt;再次输入加密串&gt;&lt;/code&gt;</code><br>这个密码会在你提交项目时使用，如果为空的话提交项目时则不用输入。这个设置是防止别人往你的项目里提交内容。<br>注意：输入密码的时候没有*字样的，你直接输入就可以了。</li>
<li>最后看到这样的界面，就成功设置ssh key了<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="https://www.2cto.com/uploadfile/Collfiles/20160329/20160329134812521.jpg" alt="kl" title="">
                </div>
                <div class="image-caption">kl</div>
            </figure>
<h3 id="添加-SSH-Key-到-GitHub和Coding"><a href="#添加-SSH-Key-到-GitHub和Coding" class="headerlink" title="添加 SSH Key 到 GitHub和Coding"></a>添加 SSH Key 到 GitHub和Coding</h3>打开Git Bash，然后输入<br><code>cd ~/.ssh</code><br>进入到.shh文件夹中再输入ls，查看是否有id_rsa.pub文件<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="https://www.2cto.com/uploadfile/Collfiles/20160329/20160329134812522.png" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure>
输入cat命令，打开id_rsa.pub文件<br><code>cat id_rsa.pub</code><figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="https://www.2cto.com/uploadfile/Collfiles/20160329/20160329134812523.png" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure></li>
<li>再鼠标全选中右击复制</li>
<li>再配置到GitHub和Coding的SSH中<br>进入Github官网，点击+旁边的头像，再按settings进入设置<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="https://www.2cto.com/uploadfile/Collfiles/20160329/20160329134812524.png" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure>
在点击New SSH key创建<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="https://www.2cto.com/uploadfile/Collfiles/20160329/20160329134812525.png" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure>
title输入邮箱，key里面粘贴刚才右击复制的内容,再点Add SSH key<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="https://www.2cto.com/uploadfile/Collfiles/20160329/20160329134812526.png" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure></li>
</ul>

        </div>

        <blockquote class="post-copyright">
    
    <footer>
        <a href="http://yoursite.com">
            <img src="https://yscoder.github.io/img/face.jpg" alt="张宁乐">
            张宁乐
        </a>
    </footer>
</blockquote>

        


        <div class="post-footer">
            
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Hexo/">Hexo</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://yoursite.com/2018/01/06/设置账户SSH/&title=《添加账户SSH （免密码上传）》 — Anson's Blog&pic=https://yscoder.github.io/img/face.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://yoursite.com/2018/01/06/设置账户SSH/&title=《添加账户SSH （免密码上传）》 — Anson's Blog&source=张宁乐,博客" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://yoursite.com/2018/01/06/设置账户SSH/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《添加账户SSH （免密码上传）》 — Anson's Blog&url=http://yoursite.com/2018/01/06/设置账户SSH/&via=http://yoursite.com" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://yoursite.com/2018/01/06/设置账户SSH/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between">
  
    <div class="waves-block waves-effect prev">
      <a href="/2018/01/09/phpGD验证码一/" id="post-prev" class="post-nav-link">
        <div class="tips"><i class="icon icon-angle-left icon-lg icon-pr"></i> Prev</div>
        <h4 class="title">phpGD验证码</h4>
      </a>
    </div>
  

  
    <div class="waves-block waves-effect next">
      <a href="/2017/12/29/移动端页面开发关键—尺寸和布局/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">移动端页面开发关键—尺寸和布局</h4>
      </a>
    </div>
  
</nav>



    











    <!-- Valine Comments -->
    <div class="comments vcomment" id="comments"></div>
    <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
    <script src="//unpkg.com/valine@latest/dist/Valine.min.js"></script>
    <!-- Valine Comments script -->
    <script>
        var GUEST_INFO = ['nick','mail','link'];
        var guest_info = 'nick,mail'.split(',').filter(function(item){
          return GUEST_INFO.indexOf(item) > -1
        });
        new Valine({
            el: '#comments',
            notify: 'false' == 'true',
            verify: 'false' == 'true',
            appId: "gbSwUaucLkuxqOLxm131Mg9U-gzGzoHsz",
            appKey: "b9xU2qIPrm06S0uymbAfrGMD",
            avatar: "mm",
            placeholder: "要不要说点什么？",
            guest_info: guest_info.length == 0 ? GUEST_INFO : guest_info,
            pageSize: "10"
        })
    </script>
    <!-- Valine Comments end -->







</article>



</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            
                <span><a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            
            <span>博客内容遵循 <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p><span>张宁乐 &copy; 2017 - 2019</span>
            <span>
                
                Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a>
            </span>
			<span>
					Hosted by <a href="https://pages.coding.me" style="font-weight: bold">Coding Pages</a>
			  </span>
        </p>
    </div>
</footer>
<!-- <script>
(function(){
    var bp = document.createElement("script");
    var curProtocol = window.location.protocol.split(":")[0];
    if (curProtocol === "https") {
        bp.src = "https://zz.bdstatic.com/linksubmit/push.js";
    }
    else {
        bp.src = "http://push.zhanzhang.baidu.com/push.js";
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script> -->

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://yoursite.com/2018/01/06/设置账户SSH/&title=《添加账户SSH （免密码上传）》 — Anson's Blog&pic=https://yscoder.github.io/img/face.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://yoursite.com/2018/01/06/设置账户SSH/&title=《添加账户SSH （免密码上传）》 — Anson's Blog&source=张宁乐,博客" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://yoursite.com/2018/01/06/设置账户SSH/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《添加账户SSH （免密码上传）》 — Anson's Blog&url=http://yoursite.com/2018/01/06/设置账户SSH/&via=http://yoursite.com" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://yoursite.com/2018/01/06/设置账户SSH/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: false };


</script>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/search.min.js" async></script>






<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>





</body>
</html>
